package io.seata.sharding4.account.dubbo;

import io.seata.sharding4.account.service.IAccountService;
import io.seata.sharding4.common.dto.AccountDTO;
import io.seata.sharding4.common.dubbo.AccountDubboService;
import io.seata.sharding4.common.response.ObjectResponse;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.seata.core.context.RootContext;

/**
 * @author Administrator
 */
@Slf4j
@RequiredArgsConstructor
@DubboService(version = "1.0.0", protocol = "${dubbo.protocol.id}", application = "${dubbo.application.id}", registry = "${dubbo.registry.id}", timeout = 30000)
public class AccountDubboServiceImpl implements AccountDubboService {
    private final IAccountService accountService;

    @Override
    public ObjectResponse decreaseAccount(AccountDTO accountDTO) {
        log.info("全局事务id ：" + RootContext.getXID());
        return accountService.decreaseAccount(accountDTO);
    }
}
